<!DOCTYPE html>
<div id="target" style="display:grid;">
  text
</div>
<script>
const target = document.getElementById('target');
document.body.offsetTop;
target.style.contentVisibility = 'hidden';
document.body.offsetTop;
target.style.contentVisibility = '';
</script>
